package cn.xiuxius.askbox.common.utils;

import org.springframework.stereotype.Component;

import java.util.Random;

@Component
public class RandomUtil {

    private final String NUMS = "0123456789";

    public String getRandomNum(int length) {
        Random rd = new Random();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < length; i++) {
            sb.append(NUMS.charAt(rd.nextInt(NUMS.length())));
        }
        return sb.toString();
    }



}
